package com.coreservlets.jsf.ss07;

import java.util.List;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.model.SelectItem;

@ManagedBean( name="colorPrefs" )
@ApplicationScoped
public class ColorPrefs 
{
	private String background;
	private String foreground;
	
	public String getBackground() 
	{
		return background;
	}
	public void setBackground(String background) 
	{
		this.background = background;
	}
	public String getForeground() 
	{
		return foreground;
	}
	public void setForeground(String foreground) 
	{
		this.foreground = foreground;
	}
	
	public List< SelectItem > getColorNames()
	{
		return( ColorUtils.getColorNames());
	}
	
	public ColorPrefs()
	{
		background = "blue";
		foreground = "white";
	}
	
	public void changeColor( String background )
	{
		this.background = background;
	}
}
